package ua.gov.diia.ui_base.components.subatomic.icon

import android.graphics.BitmapFactory
import android.util.Base64
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Badge
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import ua.gov.diia.ui_base.R
import ua.gov.diia.ui_base.components.infrastructure.utils.resource.UiText
import ua.gov.diia.ui_base.components.theme.Black
import ua.gov.diia.ui_base.components.theme.RedIndicator

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun IconWithBadge(
    modifier: Modifier,
    image: UiText,
    contentDescription: String? = "icon",
    showBadge: Boolean = false,
    imageColor: Color? = Black,
    alpha: Float = 1.0f,
) {
    Box(
        contentAlignment = Alignment.Center
    ) {
        val imageValue = when (image) {
            is UiText.DynamicString -> image.value
            is UiText.StringResource -> image.resId.let { LocalContext.current.getString(it) }
        }
        if (image is UiText.DynamicString) {
            val bitmap = remember(imageValue) {
                val byteArray = Base64.decode(imageValue, Base64.DEFAULT)
                BitmapFactory.decodeByteArray(byteArray, 0, byteArray.size)?.asImageBitmap()
            }
            if (bitmap != null) {
                Image(
                    modifier = modifier,
                    bitmap = bitmap,
                    contentScale = ContentScale.Fit,
                    colorFilter = ColorFilter.tint(Black),
                    alpha = alpha,
                    contentDescription = contentDescription
                )
            }
        } else if (image is UiText.StringResource) {
            image.resId?.let { resId ->
                Image(
                    modifier = modifier,
                    painter = painterResource(resId),
                    contentDescription = contentDescription,
                    alpha = alpha,
                )
            }
        } else {
            Image(
                modifier = modifier,
                painter = painterResource(id = R.drawable.diia_check),
                contentDescription = contentDescription,
                colorFilter = imageColor?.let { ColorFilter.tint(it) },
            )
        }

        if (showBadge) {
            Badge(
                modifier = Modifier
                    .size(8.dp)
                    .offset(1.dp, (-8).dp), // Adjust the positioning as needed
                containerColor = RedIndicator
            )
        }
    }
}


@Composable
@Preview
fun IconBase64WithBadgePreview() {
    val base64String =
        "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABwmSURBVHgB7d29liTXkR/wP0gZlEd68ph8Ag49epP01iPWW2+anmQt9ASYfQKST9ADTx5AS1qrE5boYejJ66S3sgb0RAuqi+om5qOnuz6yqjIyf79z4gwGhw7JynsjI27cTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYCE+CbBEP91Et4lnd//c4ucf+c9+u4m/bWK8i/b31wEWTQIA9bXNvd/E82w3/PtN/1gtCRg38fXdPw8BAC6q38Tnm7jZxHdnijeb+HITV9lWFwCAM+iy3fTbRvzdDOIm22QAADiBPud90983bjdxHVUBAJjEVbab61w3/ofiOhIBADjIp6m38UsEAOBAfeZd6j8kPg8A8KA2svf71NrY94nbbKsaAMCdPvXL/btGS3KmuJ8AAEr719TawKeqBnQBgBVqb8E3qbVxTx2fBQBWpMt6Sv5PxecBgBVod/TP5Ra/ucR1AGDB+tj8PxbfxOFAABboRWptyJIAADhSK/tX2oglAQBwpC7K/vvGdQCgsC5O+x8avw9wcj8OMLVWxv7fceHNoX69ib9t4s8BgEKWfK//OeNZAKCINV7ve6q4jUOBABTQxaG/qePLAMDM3abW5lolfEoYgNlS+j9dtKqKVgBMzBQAHK/bxP/YxE/CKfzkLv49ADAj16n1Rl01+gDATHSptYlWjpsAwExcp9YmWj36AMCFdam1eS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bbxAYA2FHrld+m1ob/9sbfBwA4SCubX6VOImDjB4CJXWW7wc5t07/v8XcBAE6my7Y9cMlrhdumfx1v+wBwEV22lYEvc/o2QUs4/pDtpu9EPyzAJwGWost21r7FL+/+3mKfDXvcxLebeL2Jv9z9+fru3wELIgGAdeiyTQQeSgbG9/4EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAOv4/XAW4kRwChCoAAAAASUVORK5CYII="

    Column(
        modifier = Modifier,
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        IconWithBadge(
            modifier = Modifier.size(24.dp),
            image = UiText.DynamicString(base64String),
            contentDescription = "User Icon",
            showBadge = true
        )
    }
}

@Composable
@Preview
fun IconBase64WithDisabledPreview() {
    val base64String =
        "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABwmSURBVHgB7d29liTXkR/wP0gZlEd68ph8Ag49epP01iPWW2+anmQt9ASYfQKST9ADTx5AS1qrE5boYejJ66S3sgb0RAuqi+om5qOnuz6yqjIyf79z4gwGhw7JynsjI27cTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYCE+CbBEP91Et4lnd//c4ucf+c9+u4m/bWK8i/b31wEWTQIA9bXNvd/E82w3/PtN/1gtCRg38fXdPw8BAC6q38Tnm7jZxHdnijeb+HITV9lWFwCAM+iy3fTbRvzdDOIm22QAADiBPud90983bjdxHVUBAJjEVbab61w3/ofiOhIBADjIp6m38UsEAOBAfeZd6j8kPg8A8KA2svf71NrY94nbbKsaAMCdPvXL/btGS3KmuJ8AAEr719TawKeqBnQBgBVqb8E3qbVxTx2fBQBWpMt6Sv5PxecBgBVod/TP5Ra/ucR1AGDB+tj8PxbfxOFAABboRWptyJIAADhSK/tX2oglAQBwpC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/igqBDjZv4TbbnKgCgnFep9dY9l3gWACislbAdCtwvrgIACyAJ2D1eBgAWRBJg8wdgpSQBH4+rAMDCvUqtzfmU0e5L+DQAsBIvU2ujPkXcxml/AFboKuu9MfAmLvkBYMW6bN+EK2zaU8VnAQC+9zK1NvFD4jZK/gDwgS7LrAa0NsfLKPkDwKOuspxE4CbbxAYA2FHrld+m1ob/9sbfBwA4SCubX6VOImDjB4CJXWW7wc5t07/v8XcBAE6my7Y9cMlrhdumfx1v+wBwEV22lYEvc/o2QUs4/pDtpu9EPyzAJwGWost21r7FL+/+3mKfDXvcxLebeL2Jv9z9+fru3wELIgGAdeiyTQQeSgbG9/4EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAOv4/XAW4kRwChCoAAAAASUVORK5CYII="

    Column(
        modifier = Modifier,
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        IconWithBadge(
            modifier = Modifier.size(24.dp),
            image = UiText.DynamicString(base64String),
            contentDescription = "User Icon",
            showBadge = false,
            alpha = 0.3f
        )
    }
}